package vip.linfeng.securitydemo.controller;

import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;
import vip.linfeng.securitydemo.domain.User;
import vip.linfeng.securitydemo.service.UserService;

import java.util.List;

/**
 * @auth linfeng
 * @create 2025/8/9 10:29
 * @Description
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Resource
    public UserService userService;

    @GetMapping("/list")
    public List<User> getList() {
        System.out.println("收到查询请求");
        return userService.list();
    }

    @PostMapping("/add")
    public String add(@RequestBody User user) {
        userService.saveUserDetails(user);
        return "success";
    }
}
